package service.impl;

import repository.ReaderRepository;
import repository.impl.AdminRepositoryImpl;
import repository.impl.ReaderRepositoryImpl;
import service.LoginService;

import java.sql.SQLException;

public class LoginServiceImpl implements LoginService {
    private ReaderRepository readerRepository=new ReaderRepositoryImpl();
    private AdminRepositoryImpl adminRepository=new AdminRepositoryImpl();

    @Override
    public Object login(String username, String password,String type) throws SQLException {
        Object object=null;
        switch (type){
            case "reader":
                object=readerRepository.login(username, password);
                break;
            case "admin":
                object=adminRepository.login(username, password);
                break;
        }
        return object;
    }


}
